package com.wyh.utils.sqlUtils.repairstatus;

import com.wyh.entity.Repairstatus;

import javax.validation.constraints.NotNull;

public class updateRepairStatusSqlDynamic {
    public String updateDynamic(@NotNull Repairstatus repairstatus)
    {
        StringBuilder builder = new StringBuilder();
        if (repairstatus.getProgress()!=null) {
            if (builder.length() > 0) {
                builder.append(", ");
            }
            builder.append("progress = #{progress} ");
        }
        if (repairstatus.getRemark()!=null){
            if (builder.length() > 0) {
                builder.append(", ");
            }
            builder.append("remark = #{remark} ");
        }

        StringBuilder sql = new StringBuilder();
        sql.append("update repairstatus set ");
        sql.append(builder);
        sql.append(" WHERE   id = #{id}; ");

        System.out.println(sql);
        return sql.toString();
    }
}
